<template>
	<div>
		<div class="bt">
			<h1 v-if="tableData!= undefined">{{tableData.title}}</h1>
			<p class="sp">
				<span>发布人：</span>
				<span v-if="tableData != undefined">{{ tableData.create_by }}</span>
				<span class="btq">发布时间：</span>
				<span v-if="tableData != undefined">{{ tableData.publish_time }}</span>
				<!-- <span>发布人</span><span>2</span></p> -->
			</p>
		</div>
<!-- :placeholder="tableData.articleData.content" --><!-- tableData.articleData -->
		<textarea readonly v-if="tableData != undefined"  class="nr" v-model="tableData.content" ></textarea>
		<div>
			<textarea  class="pl" v-model="pinglun.c_content" :placeholder="pinglun.c_content"></textarea>
			<el-button class="plan" type="primary" @click="plfb()">评论</el-button>
		<!-- 	<button class="plan" @click="plfb()">评论</button> -->
		</div>
	</div>
</template>

<script>
export default {
	name: 'neirongZJ',
	data() {
		return {
			index: '',
			tableData: {},
			pinglun:{				 
				article_id:'', //文章标识
				expert_id:localStorage.getItem('id'),  //专家标识
				c_content:'',  //评论内容
				create_date:Date,    //创建时间
				is_recommend:'0'
			}
		};
	},
	mounted() {
		let that = this;
		// (this.id = this.$route.query.id),
		this.index = localStorage.getItem('index');
		// alert(this.index);
		this.$axios
			.post('http://localhost:8080/selectdat/dataneirongExpert', this.$qs.stringify({ id: this.index }))
			.then(function(response) {

					that.tableData=response.data;

			})
			.catch(function(error) {
				console.log(error);
			});
			

	},
	methods:{
		plfb() {
			var that =this;
			this.pinglun.article_id=this.tableData.id;
			console.log(this.pinglun.expert_id);
						console.log(this.pinglun.article_id + "qqqqqqq");
			this.$axios
				.post('http://localhost:8080/comment/PingLun',
				this.$qs.stringify({
					article_id:this.pinglun.article_id,
					expert_id:this.pinglun.expert_id,
					c_content:this.pinglun.c_content,
					is_recommend:this.pinglun.is_recommend}))
				
				.then(function(response) {
					alert("评论成功");
					    that.$router.push({'path':'/loginZJ/wdplZJ'})
				})
				.catch(function(error) {
					console.log(error);
				});
		}
	}
};
</script>

<style scoped>
.bt {
	border: 1px solid rgba(0, 0, 0, 0.5);
	height: 100px;
	margin-bottom: 5px;
	padding-top: 20px;
}
.pl{
	height: 70px;
	width: 95%;
	padding: 22px;
	font-size: 20px;
	margin-top: 30px;
}
.btq {
	margin-left: 20px;
}
.sp {
	padding-top: 10px;
}
.nr {
	
	height: 300px;
	width: 95%;
	padding: 22px;
	font-size: 20px;
}

</style>
